<?php
	session_name("Admin");
	session_start();
	$Nombre="";
	$Paterno="";
	$Materno="";
	$Usuario="";
	$Pass="";
	if($_SESSION['Administrador']==1)
	{
		if(empty($_SESSION['ID']))
		{
			echo "<script>alert('Ha Ocurrido un Error');
						  document.location.href='Cambio.php'</script>";
		}
		else
		{
			include ("../Conexciones/Conexcion.php");
			$_ID=$_SESSION['ID'];
			$Sql=sprintf("select nombre, apellidopaterno,apellidomaterno,usuario from usuarios where idusuario='%s'",$_ID);
			if($Res=pg_query($Conexcion,$Sql))
			{
				if($Row=pg_fetch_array($Res))
				{
					$Nombre=$Row[0];
					$Paterno=$Row[1];
					$Materno=$Row[2];
					$Usuario=$Row[3];
				}
				else
				{
				}
			}
			else
			{
				print pg_last_error($Conexcion);
			}			
		}
	}
	else
	{
		echo "<script>alert('Su Sesion no ha sido iniciada');
					  document.location.href='../index.html'</script>";
	}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CAMBIOS DE USUARIO</title>
<link href="../Estilos/Est1.css" type="text/css" rel="stylesheet" />
<script language="javascript" src="../Scripts/Lib1.js">
</script>
</head>
<body bgcolor="#999999">
<center>
<table  bgcolor="#CCCCCC" border="3" height="550" width="90%">
	<tr height="20%">
    	<td bgcolor="#FFFFFF">
        	<div class="Est5" align="center"> <u>VENTANA DE CAMBIOS DE USUARIO</u></div>
        </td>
    </tr>
    <tr height="80%">
    	<td align="center">
        <form method="post" name="Alta" action="Procesar.php">
        	<table border="0">
            	<tr>
                	<td>
                    	<div class="Est2" align="right">NOMBRE:</div>
                    </td>
                    <Td>
                    	<?php
							$Cadena=sprintf("<input type='text' name='m_Nombre' id='m_apepat' maxlength='20' size='20' onkeydown='return ValidarLetras(event)' value='%s'>", rtrim(ltrim($Nombre)));
							print "$Cadena"; 
						?>
                    </Td>
                </tr>
                <tr>
                	<td>
                    	<div class="Est2" align="right">APELLIDO PATERNO:</div>
                    </td>
                    <Td>
                    	<?php
                    		$Cadena=sprintf('<input type="text"  name="m_apepat" id="m_apepat" maxlength="20" size="20" onkeydown="return ValidarLetras(event)" value="%s">',rtrim(ltrim($Paterno)));
							print $Cadena;
						?>
                    </Td>
                </tr>
                <tr>
                	<td>
                    	<div class="Est2" align="right">APELLIDO MATERNO:</div>
                    </td>
                    <Td>
                    	<?php
                    	$Cadena=sprintf('<input type="text" name="m_apemat" id="m_apemat" maxlength="20" size="20" onkeydown="return ValidarLetras(event)" value="%s">',rtrim(ltrim($Materno)));
						print $Cadena;
						?>
                    </Td>
                </tr>
                <tr>
                	<td>
                    	<div class="Est2" align="right">NOMBRE DE USUARIO:</div>
                    </td>
                    <Td>
                    	<?php
                    	$Cadena=sprintf('<input type="text" name="m_User" id="m_User" maxlength="20" size="20" value="%s">',ltrim(rtrim($Usuario)));
						print $Cadena;
						?>
                    </Td>
                </tr>
                <tr>
                	<td>
                    	<div class="Est2" align="right">PASSWORD:</div>
                    </td>
                    <Td>
                    	<input type="password" name="m_Pass" id="m_Pass" maxlength="20" size="20">
                    </Td>
                </tr>
                <tr>
                	<td>
                    	<div class="Est2" align="right"> REPETIR PASSWORD:</div>
                    </td>
                    <Td>
                    	<input type="password" name="m_Pass2" id="m_Pass2" maxlength="20" size="20">
                    </Td>
                </tr>
                <Tr>
                	<td colspan="2" align="center">
                    	<input type="hidden" value="4" name="m_Flag" id="m_Flag" />
                        <?php
							$Cadena=sprintf('<input type="hidden" value="%s" name="ID" id="ID"/>',$_ID);
							print $Cadena;
						?>
                    	<input type="submit" name="m_Enviar" value="Enviar" onclick="return ValidarAlta()"/>
                    </td>
                </Tr>
                <td colspan="2" align="center"><br /><Div style="color:#FFF; font-size:22px"><a href="Cambio.php" onclick="">Volver</a></Div></td>
            </table>
            </form>
        </td>
    </tr>
</table>
</center>
</body>
</html>
